import { createApp } from 'vue'
import { createStore } from 'vuex'
import * as authUtil from '@/ts/AuthUtils'

// 创建一个新的 store 实例
const store = createStore({
    state () {
        return {
          count: 0,
          selectedItem:null
        }
    },
    getters:{
        permit:(state)=>(buttonName:String)=>{
          return authUtil.permit(buttonName);
      }
  },
  actions: {
    selectedItem({ commit }, item) {
      commit('selectedItem', item);
    }
  },
    mutations: {
        increment (state) {
            state.count++
      },
      selectedItem(state, item) {
          state.selectedItem = item;
        }
    }
})

export default store;